package com.hanbang.maige.mode.javabean.quanzi;

import android.os.Parcel;
import android.os.Parcelable;

import com.baidu.mapapi.model.LatLng;
import com.hanbang.maige.utils.other.StringUtils;

/**
 * 作者　　: 李坤
 * 创建时间:2016/11/1　14:29
 * 邮箱　　：496546144@qq.com
 * <p>
 * 功能介绍：
 */

public class PoiData implements Parcelable {

    public String address;
    public LatLng location;
    public String title;

    public String getAddress() {
        return address == null ? "" : address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public LatLng getLocation() {
        return location;
    }

    public void setLocation(LatLng location) {
        this.location = location;
    }

    public String getTitle() {
        return StringUtils.dataFilter(title);
    }

    public void setTitle(String title) {
        this.title = title;
    }


    public static PoiData getOneData() {
        PoiData dNo = new PoiData();
        dNo.setTitle("不显示位置");
        return dNo;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.address);
        dest.writeParcelable(this.location, flags);
        dest.writeString(this.title);
    }

    public PoiData() {
    }

    protected PoiData(Parcel in) {
        this.address = in.readString();
        this.location = in.readParcelable(LatLng.class.getClassLoader());
        this.title = in.readString();
    }

    public static final Parcelable.Creator<PoiData> CREATOR = new Parcelable.Creator<PoiData>() {
        @Override
        public PoiData createFromParcel(Parcel source) {
            return new PoiData(source);
        }

        @Override
        public PoiData[] newArray(int size) {
            return new PoiData[size];
        }
    };
}
